<template>
<div>
  <div class="block">
    <!-- <span class="demonstration">完整功能</span> -->
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage"
      :page-sizes="[10, 20, 30, 40]"
      :page-size="pageSize"
      layout="total, sizes, prev, pager, next, jumper"
      :total=total>
    </el-pagination>
  </div>
</div>
</template>
<script>
  export default {
    props:["total","pageSize"],
    methods: {
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);//控制父组件的pagesize
        this.$parent.pageSize=val;
        this.$parent.getData();
      },
      handleCurrentChange(val) {
        console.log(`当前页: ${val}`);//控制父组件的page
        this.$parent.page=val;
        this.$parent.getData();
      }
    },
    data() {
      return {
        currentPage: 1
      };
    }
  }
</script>
<style>

</style>